home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: ShowAG.bed 1.0 (03.03.96)
- **
- ** If a block is selected, save this block as an AmigaGuide database,
- ** and display it.
- **
- ** If no block is selected, determine if the cursor is currently within
- ** an AmigaGuide node. If so, create an AmigaGuide database containing only
- ** this node, and display it.
- **
- ** If no block is selected, and the cursor is not currently within an
- ** AmigaGuide node, display the whole document as an AmigaGuide database.
- **
- ** Modified by Marco Negri
- */
-
- OPTIONS RESULTS
- OPTIONS FAILAT 21
- TRACE RESULTS
- SetDisplayLock ON
- SetInputLock ON
-
- TaskID = Pragma('ID')
- tempname = 'T:ShowAG-' || TaskID
-
- GetCursorPos
- PARSE VAR RESULT cursorLine cursorColumn .
-
- GetBlkInfo
- PARSE VAR RESULT blockActive . blockLine blockColumn .
-
- GetFileInfo
- PARSE VAR RESULT . . '"'nodeName'"' .
-
- IF blockActive = OFF THEN DO
-
- GetPrefs FindIgnoreCase
- ignore = RESULT
- SetPrefs FindIgnoreCase ON
-
- GetPrefs FindBackward
- back = RESULT
- SetPrefs FindBackward ON
-
- Find "@node"
- IF RC = 0 THEN DO
- GetLine
- PARSE VAR RESULT . '"' nodeName '"' .
- MoveDown
- END; ELSE DO
- MoveSOF
- END
- MarkBlk
-
- SetPrefs FindBackward OFF
-
- Find "@endnode"
- IF RC > 0 THEN DO
- MoveBookmark 10
- END
-
- IF Open(file, tempname, WRITE) THEN DO
- WriteLn(file,'@database "'nodeName'"');
- WriteLn(file,'@node Main "'nodeName'"');
- Close(file);
- END
-
- CopyBlk UNIT 314
- SaveClip UNIT 314 QUIET NOICON NOBACKUP APPEND tempname
-
- SetPrefs FindBackward back
- SetPrefs FindIgnoreCase ignore
-
- IF Open(file, tempname, APPEND) THEN DO
- WriteLn(file,"@endnode");
- Close(file);
- END
-
- END; ELSE DO
- GetBlk lines
-
- IF Open(file, tempname, WRITE) THEN DO
- WriteLn(file,'@database "'nodeName'"');
- WriteLn(file,'@node Main "'nodeName'"');
-
- DO i = 1 TO lines.0
- WriteCh(file,lines.i)
- END
- WriteLn(file,"")
- WriteLn(file,"@endnode");
- Close(file)
- DROP lines.
- END
- END
-
- SetDisplayLock OFF
- SetInputLock OFF
-
- ADDRESS COMMAND 'MultiView' tempname
-
- IF ~Show(L,'rexxsupport.library') THEN DO
- AddLib('rexxsupport.library',0,-30)
- END;
-
- ADDRESS COMMAND 'Wait 10'
-
- Delete(tempname)
-